package com.zhoukx.composite;

/**
 * @ClassName Client
 * @Description:  组合模式
 * @Author zhoukx
 * @Date 2020/8/10
 **/
public class Client {

    public static void main(String[] args) {
        //从大到小创建对象
        OrganizationComponet university = new University("清华大学", "顶级大学");
        // 创建学院
        OrganizationComponet computerCollege = new College("计算机学院", "计算机学院");
        OrganizationComponet infoEngineercollege2 = new College("信息工程学院", "信息工程学院");

        // 创建学院下的系
        computerCollege.add(new Department("软件工程","软件工程"));
        computerCollege.add(new Department("网络工程","网络工程"));
        computerCollege.add(new Department("计算机科学与技术","计算机科学与技术"));

        infoEngineercollege2.add(new Department("安全技术","安全技术"));
        infoEngineercollege2.add(new Department("通信工程","通信工程"));
        infoEngineercollege2.add(new Department("信息工程","信息工程"));
        // 将学院加入到学校
        university.add(computerCollege);
        university.add(infoEngineercollege2);
        // 打印所有
        university.print();


        computerCollege.print();


    }
}
